/**
 * 2012-7-8
 * jqsl2012@163.com
 */
package net.jeeshop.services.front.indexnews.impl;

import net.jeeshop.core.ServersManager;

import net.jeeshop.services.front.indexnews.IndexNewsService;
import net.jeeshop.services.front.indexnews.bean.IndexNews;
import net.jeeshop.services.front.indexnews.dao.IndexNewsDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * @author huangf
 */
@Service("indexnewsServiceFront")
public class IndexNewsServiceImpl extends ServersManager<IndexNews, IndexNewsDao> implements
		IndexNewsService {

    @Resource(name = "indexnewsDaoFront")
    @Override
    public void setDao(IndexNewsDao newsDao) {
        this.dao = newsDao;
    }
	/**
	 * @param e
	 */
	public List<IndexNews> selecIndexNews(IndexNews e) {
		return dao.selecIndexNews(e);
	}

	@Override
	public void updateStatus(String[] ids, String status) {
		if(ids==null || ids.length==0){
			return;
		}
		
		for(int i=0;i<ids.length;i++){
			IndexNews news = new IndexNews();
			news.setId(ids[i]);
			news.setStatus(status);
			dao.sync(news);
		}
//		throw new NullPointerException();
	}

	@Override
	public void updateDownOrUp(IndexNews news) {
		dao.updateDownOrUp(news);
	}

	@Override
	public int selectCount(IndexNews news) {
		return dao.selectCount(news);
	}

}
